<%@ page import="com.webtest.listener.Customer" %>
<%@ page import="java.time.Instant" %><%--
  Created by IntelliJ IDEA.
  User: lzy
  Date: 2018/8/21
  Time: 13:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Binding</title>
</head>
<body>
<%
/*    Customer customer = new Customer();
    session.setAttribute("cust", customer);
    System.out.println("---------------------------");

    session.removeAttribute("cust");*/

    Object customer = session.getAttribute("customer");
    if (customer == null) {
        System.out.println("创建一个新的customer对象，并放入到session中");
        customer = new Customer();
        ((Customer) customer).setTime(Instant.now().toString());
        session.setAttribute("cust", customer);
    } else {
        System.out.println("从session中读取到customer对象"+customer);
    }
%>
</body>
</html>
